import request from '../utils/request'

// 获取所以已打的串口
export function getPorts(params, loading) {
  return request({
    url: '/api/connection-manage/get-ports',
    method: 'get',
    loading: loading,
    params
  })
}

export function getPortswrj(params, loading) {
  return request({
    url: '/api/connection-manage/get-ports/wrj',
    method: 'get',
    loading: loading,
    params
  })
}

export function getPortshx(params, loading) {
  return request({
    url: '/api/connection-manage/get-ports/hx',
    method: 'get',
    loading: loading,
    params
  })
}

export function getPortscld(params, loading) {
  return request({
    url: '/api/connection-manage/get-ports/cld',
    method: 'get',
    loading: loading,
    params
  })
}

// 关闭串口监听
export function connectPort(params) {
  return request({
    url: `/api/connection-manage/connect-port`,
    method: 'get',
    loading: false,
    params
  })
}

export function connectPortwrj(params) {
  return request({
    url: `/api/connection-manage/connect-port/wrj`,
    method: 'get',
    loading: false,
    params
  })
}

export function connectPorthx(params) {
  return request({
    url: `/api/connection-manage/connect-port/hx`,
    method: 'get',
    loading: false,
    params
  })
}

export function connectPortcld(params) {
  return request({
    url: `/api/connection-manage/connect-port/cld`,
    method: 'get',
    loading: false,
    params
  })
}

// 4g数据刷新
export function refreshDataApi() {
  return request({
    url: `/4g-data`,
    method: 'get'
  })
}
